package com.fire.market.product.api.service;

import com.fire.component.dto.Response;
import com.fire.component.dto.SingleResponse;
import com.fire.market.product.api.dto.ItemInfo;
import com.fire.market.product.api.mq.ItemStockMqMessage;
import com.fire.market.product.api.request.ItemAddParam;
import com.fire.market.product.api.request.ItemDecreaseParam;
import com.fire.market.product.api.result.ItemStockDecreaseResult;

/**
 * ItemCmdFrontService
 *
 * @author zwd
 * @date 2021/7/20
 */
public interface ItemCmdFrontService {
    /**
     * 创建商品
     * @param param
     * @return
     */
    SingleResponse<ItemInfo> addItem(ItemAddParam param);
    /**
     * 通过缓存减库存
     * @param param
     * @return
     */
    SingleResponse<ItemStockDecreaseResult> decreaseItemStockByCache(ItemDecreaseParam param);

    /**
     * 增加商品的销量
     * @param itemId
     * @param amount
     */
    Response increaseSales(Integer itemId, Integer amount);

    /**
     * 异步扣减库存
     * @param itemStockMqMessage
     */
    Response syncDecreaseItemStockByMq(ItemStockMqMessage itemStockMqMessage);

    /**
     * 增加库存
     * @param itemDecreaseParam
     * @return
     */
    Response increaseItemStockByCache(ItemDecreaseParam itemDecreaseParam);

    Response decreaseSales(ItemDecreaseParam itemDecreaseParam);
}
